package com.tfjybj.msg.data.controller;

import com.tfjybj.msg.commons.entity.table.MessageEntity;
import com.tfjybj.msg.commons.utils.MsgResult;
import com.tfjybj.msg.commons.utils.ResultCode;
import com.tfjybj.msg.commons.utils.ResultMessage;
import com.tfjybj.msg.data.service.MessageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Description:
 * @Author: xuziguo
 * @Date: 2021/4/19 下午 8:11
 * @Modified By:
 * @Modify Date:
 */
@Api(tags = "钉钉消息记录")
@RestController
@RequestMapping("/data/message/")
public class MessageController {

    @Resource
    private MessageService messageService;

    @ApiOperation("添加消息记录")
    @PostMapping("addMessage")
    public MsgResult addMessage(@RequestBody MessageEntity messageEntity) {
        messageService.addMessage(messageEntity);
        return MsgResult.build(ResultCode.SUCCESS, ResultMessage.CREATESUCCESS);
    }

    @ApiOperation("删除消息记录")
    @PutMapping("deleteMessage/{id}")
    public MsgResult deleteMessage(@PathVariable("id") String id) {
        messageService.deleteMessage(id);
        return MsgResult.build(ResultCode.SUCCESS, ResultMessage.DELETESUCCESS);
    }
}
